﻿using Ewk.Math.Algebra.Algorithms.Matrices;
using Ewk.Math.Algebra.Algorithms.Matrices.Determinant;
using Ewk.Math.ComputationTypes;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ewk.Math.Algebra.UnitTests.Determinant.DeterminantManipulationsTests.Int32Tests
{
    [TestClass]
    public class SubtractMatrixInt32Tests : DeterminantManipulationsInt32Base
    {
        [TestMethod]
        public void When_Subtract_Is_Called_With_A_Matrix_Then_The_Value_Of_The_Determinant_Must_Be_Null()
        {
            var matrix = Matrix;

            IMatrixManipulations<int, Computable<int>> manipulations = new DeterminantManipulator<int>(Matrix,
                                                                                                       Determinant);
            var result = manipulations.Subtract(matrix);

            for (var i = 0; i < matrix.RowCount; i++)
            {
                for (var j = 0; j < matrix.ColumnCount; j++)
                {
                    Assert.AreEqual(matrix[i, j], Matrix[i, j]); // Entries remain untouched
                }
            }

            Assert.IsNull(result);
        }

        [TestMethod]
        public void When_Subtract_Is_Called_With_Null_Then_The_Value_Of_The_Determinant_Must_Be_Null()
        {
            IMatrixManipulations<int, Computable<int>> manipulations = new DeterminantManipulator<int>(Matrix,
                                                                                                       Determinant);
            var result = manipulations.Subtract((Matrix<int>) null);

            Assert.IsNull(result);
        }
    }
}